<template>
	<view class="content">
		<!-- <view class="upbox flex-col flex-c">
			<u-upload ref="Upload" max-count="1" @on-success="submit" :action="HOSTURL + action" name="image" :form-data="formdata" :auto-upload="false">
			</u-upload>
			<text>上传微信二维码</text>
		</view> -->
		<!-- <u-field :border-bottom="false" placeholder="请填写微信" v-model="wxcount"></u-field> -->
		<view class="wechat">
			<input type="text" placeholder="请填写微信" v-model="wxcount"/>
		</view>
		<button class="ljxg" @click="submit">立即修改</button>
		<view class="tips">
			1、为减少用户骚扰，仅会员或付费才能查看 <br>
			2、修改微信需要客服审核通过后才生效，请耐心等待 <br>
			3、请勿上传他人微信，情况恶劣者，
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				HOSTURL: this.$HOSTURL,
				action: '/api/Tool/imagesUpload',
				wxcount: '',
				wx_qrcode: '',
				show_code: '',
				formdata: {
					water: 1,
					thumb: 1,
					user_id: this.$store.state.userid
				}
			}
		},
		onLoad() {
			this.$store.dispatch('getuserinfo').then(res => {
				if (res.wx_qrcode) {
					this.wx_qrcode = res.wx_qrcode;
					this.show_code = this.$HOSTURL + res.wx_qrcode;
				}
				this.wxcount = res.wxcount;
			})
		},
		methods: {
			async submit(image, index, lists, name){
				const {data:res} = await this.$Request({
					url:'api/user/editInfo',
					data: {
						user_id: this.$store.state.userid,
						// wx_qrcode: image.data.image,
						wxcount: this.wxcount
					}
				})
				uni.hideLoading()
				this.$u.toast(res.msg);
				if (res && res.code == 200) {
					setTimeout(()=>{
						uni.navigateBack()
					},1500)
				}
			},
			// up() {
			// 	if (!this.wxcount) {
			// 		this.$u.toast('请填写微信号');
			// 		return;
			// 	}
			// 	uni.showLoading({
			// 		mask:true
			// 	})
			// 	this.$refs.Upload.upload()
			// }
		}

	}
</script>

<style scoped lang="scss">
	.content {
		/* #ifndef H5 */
		min-height: 100vh;
		/* #endif */
		/* #ifdef H5 */
		min-height: calc(100vh - 44px);
		/* #endif */
		background-color: #2A2931;

		.upbox {
			padding: 60rpx;

			text {
				color: #ccc;
				font-size: 24rpx;
				margin-top: 10rpx;
			}
		}

		/deep/.u-field {
			margin: 60rpx 0;

			.u-label-text {
				color: #ccc;
			}

			input {
				color: #fff;
			}
		}
		.wechat{
			width:635rpx;
			height: 100rpx;
			margin: 60rpx;
			background: #434343;
			color: #828282;
			line-height: 100rpx;
			input{
				width: 575rpx;
				height: 100%;
				margin: 0 30rpx;
			}
		}
		.ljxg{
			width:400rpx;
			height: 100rpx;
			margin: 375rpx auto 0;
			background: #7d7d7d;
			color: #fff;
			border-radius: 50rpx;
		}
		.tips{
			margin: 60rpx;
			height: 111rpx;
			font-size: 25rpx;
			font-weight: 400;
			color: #FFFFFF;
			line-height: 43rpx;
			text-align: center;
		}
	}
</style>
